<!DOCTYPE html>
<title>Video element with src="" should invoke media element's load algorithm and should fire "error" event. Network state should be NETWORK_NO_SOURCE and the error code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.onloadstart = t.step_func(function() {});
    video.onloadedmetadata = t.step_func(function() {});
    video.onloadeddata = t.step_func(function() {});
    video.onabort = t.step_func(function() {});
    video.onemptied = t.step_func(function() {});
    video.onerror = t.unreached_func();

    video.oncanplaythrough = t.step_func(function() {
        // video with empty src attribute.
        video.src = "";
        video.onerror = t.step_func_done(function(event) {
            assert_equals(event.target, video);
            assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
            assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
        });
    });

    // video with valid non-empty "src" attribute.
    video.src = "content/test.ogv";
});
</script>